package com.nenude.corejava.ch7.homework;

import java.util.Scanner;
 class Gardener{
	public Fruit create(){
		System.out.println("输入水果：");
		Scanner scanner=new Scanner(System.in);
		String str=scanner.next();
		
		Fruit fruit=null;
		
		if(str.equals("苹果")){
			fruit=new Apple();
		}
		else if(str.equals("香蕉")) {
			fruit=new Banana();
		}else if(str.equals("葡萄")){
			fruit=new Grape();
		}		
		return fruit;
		
	}	
}
